package com.umerclass.ui.home;

import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.umerclass.R;
import com.umerclass.bean.home.ClassDirBean;
import com.umerclass.frame.model.InfoResult;
import com.umerclass.frame.ui.fragment.BaseFragment;
import com.umerclass.frame.ui.recycleview.listener.OptListener;
import com.umerclass.ui.home.adapter.ClassDirAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 课程详情
 */
public class ClassDetailsFragment extends BaseFragment implements OptListener {

    @BindView(R.id.recycleview)
    RecyclerView recycleview;
    private ClassDirAdapter classDirAdapter;
    private List<ClassDirBean> infos = new ArrayList<>();
    private LinearLayoutManager linearLayoutManager;

    public static ClassDetailsFragment newInstance() {
        return new ClassDetailsFragment();
    }

    @Override
    public boolean isImmersionBarEnabled() {
        return false;
    }

    @Override
    public int getLayoutResId() {
        return R.layout.fragment_class_details;
    }

    @Override
    public void init() {

        todo();
        classDirAdapter = new ClassDirAdapter(getActivity(),infos,R.layout.activity_home_class_dir_item,this);
        linearLayoutManager = new LinearLayoutManager(getActivity());
        recycleview.setLayoutManager(linearLayoutManager);
        recycleview.setAdapter(classDirAdapter);
    }

    @Override
    public void loadData() {

    }

    @Override
    public void onOptClick(View view, Object object) {

    }

    @Override
    protected void onSuccess(int what, InfoResult t) {

    }

    @Override
    protected void onFail(int what, InfoResult t) {

    }

    private void todo(){
        for(int i=0;i<15;i++){
            ClassDirBean classDirBean = new ClassDirBean();
            classDirBean.setCreateDate("2015-02-01");
            classDirBean.setName("好好学习");
            classDirBean.setTime("10:02:01");
            classDirBean.setTitle("不知道说是什么呢");
            infos.add(classDirBean);
        }
    }
}
